import { computed } from "vue"
import { useStore } from "vuex" 

export function useMapper(mapper, mapFunc) {

  const store = useStore()
  const storeMapperFns = mapFunc(mapper)

  const storeMapper = {}

  Object.keys(storeMapperFns).forEach(key => {
    const fn = storeMapperFns[key].bind({$store: store})
    storeMapper[key] = computed(fn)
  })

  return storeMapper
}